//-----------------Sonic CD Bones Script-------------------//

sub ObjectDraw
	GetBit(checkResult, object.propertyValue, 7)
	if checkResult == true
		Object.DrawOrder = 5
	else
		Object.DrawOrder = 3
	end if

	Object.Frame = Object.PropertyValue
	Object.Frame &= 0xF

	DrawSprite(Object.Frame)
end sub


sub ObjectStartup
	LoadSpriteSheet("R4.5/Objects3.gif")
	SpriteFrame(-10, -15, 20, 30, 1, 99) 
	SpriteFrame(-25, -20, 50, 42, 22, 99) 
	SpriteFrame(-7, -7, 15, 15, 6, 130) 
	SpriteFrame(-8, -14, 16, 28, 1, 146) 
	SpriteFrame(-8, -20, 16, 40, 18, 146) 
	SpriteFrame(-8, -20, 16, 40, 35, 146) 
	SpriteFrame(-8, -16, 16, 32, 1, 175) 
	SpriteFrame(-13, -9, 26, 19, 1, 208) 
	SpriteFrame(-14, -7, 28, 15, 28, 210) 
	SpriteFrame(-10, -9, 20, 18, 1, 228) 
	SpriteFrame(-10, -9, 20, 18, 22, 228) 
end sub

// ========================
// Editor Subs
// ========================

sub RSDKEdit
	if editor.returnVariable == true
		switch editor.variableID
		case EDIT_VAR_PROPVAL // property value
			checkResult = object.propertyValue
			break
			
		case 0 // collisionPlaneU
			GetBit(checkResult, object.propertyValue, 7)
			break
		end switch
	else
		switch editor.variableID
		case EDIT_VAR_PROPVAL // property value
			object.propertyValue = editor.variableValue
			break
			
		case 0 // size
			CheckNotEqual(editor.variableValue, false)
			SetBit(object.propertyValue, 7, checkResult)
			break
		end switch
	end if
end sub

sub RSDKDraw
	Object.Frame = Object.PropertyValue
	Object.Frame &= 0xF
	DrawSprite(Object.Frame)
end sub


sub RSDKLoad
	LoadSpriteSheet("R4.5/Objects3.gif")
	SpriteFrame(-10, -15, 20, 30, 1, 99) 
	SpriteFrame(-25, -20, 50, 40, 22, 99) 
	SpriteFrame(-7, -7, 15, 15, 6, 130) 
	SpriteFrame(-8, -14, 16, 28, 1, 146) 
	SpriteFrame(-8, -20, 16, 40, 18, 146) 
	SpriteFrame(-8, -20, 16, 40, 35, 146) 
	SpriteFrame(-8, -16, 16, 32, 1, 175) 
	SpriteFrame(-13, -9, 26, 19, 1, 208) 
	SpriteFrame(-14, -7, 28, 15, 28, 210) 
	SpriteFrame(-10, -9, 20, 18, 1, 228) 
	SpriteFrame(-10, -9, 20, 18, 22, 228) 
	SpriteFrame(-10, -9, 20, 18, 22, 228) 

	SetVariableAlias(ALIAS_VAR_PROPVAL, "sprite")

	AddEditorVariable("drawHigh")
	SetActiveVariable("drawHigh")
	AddEnumVariable("false", false)
	AddEnumVariable("true", true)
end sub
